package source.model;

import source.model.type.AreaEffect_ModHealth_Type;
import source.model.type.AreaEffectType;
import source.view.MainScreen;

/**
 * This area effect takes a unit and heals it.
 * @author Tristan
 *
 */
public class AreaEffect_Heal extends AreaEffect {
	
	private AreaEffect_ModHealth_Type AEMHT;
	
	public AreaEffect_Heal(AreaEffect_ModHealth_Type AEMHT) {
		super();
		if(AEMHT == AreaEffect_ModHealth_Type.HEAL1)
			setType(AreaEffectType.HEAL);
		else
			setType(AreaEffectType.DAMAGE);

		this.AEMHT = AEMHT;
	}

	/**
	 * @param Unit u
	 * Heals the unit U
	 */
	public boolean doEffect(Unit u) {
		MainScreen.writeToConsole(u.getType() + " is affected by strange outside elements");
		u.modHealthAreaEffect(AEMHT.getHealthMod());
		return true;
	}

	public boolean doEffect(DataHandler dh, Unit u){
		return doEffect(u);
	}
	
	public java.util.Hashtable<String, String> getViewData()
	{
		java.util.Hashtable<String, String> viewData = super.getViewData();
		
		viewData.put("Area Effect Type", "Health Modifier");
		viewData.put("Area Effect Name", AEMHT.getName());
		viewData.put("Area Effect Message", AEMHT.getMsg());
		viewData.put("Area Effect Damage", Integer.toString(AEMHT.getHealthMod()));
		
		return viewData;
	}

}
